//mixins混入
import {
	mapGetters
} from 'vuex'

export default {
	computed: {
		...mapGetters('m_cart', ['allGoodsCount'])
	},
	onShow() {
		uni.setTabBarBadge({
			index: 2,
			text: String(this.allGoodsCount)
		})
	},
	watch: {
		//商品总数量
		allGoodsCount: {
			handler(newCount) {
				//设置tabBar上的角标
				uni.setTabBarBadge({
					index: 2, //第几项角标
					text: String(this.allGoodsCount)
				})
			},
			immediate: true //页面加载时
		}
	}
}
